library(coin)
library(ggplot2)
library(scales)
library(dplyr)
library(ebal)
library(survey)
library(psych)
library(list)
library(stm)
library(tm)
library(quanteda)
library(tidyr)
library(tidytext)
library(textdata)
library(foreign)
library(utils)


#####Load TESS.csv and Save as "TESS"#####


#####Recode Variables (see Codebook for definitions)#####

###Create Aggregate Hostile Sexism Measure###
rescale <- function(x){
  return((x-min(x,na.rm=TRUE))/(max(x-min(x,na.rm=TRUE),na.rm=TRUE)))
}

TESS$HostileSexism <- (TESS$HostileSexism1 + TESS$HostileSexism2 + TESS$HostileSexism3 + TESS$HostileSexism4) / 4

TESS$HostileSexism <- rescale(TESS$HostileSexism)

#Calculate Cronbach's Alpha (Note: Equals 0.78, which indicates good reliability. Cannot improve if drop any component variable)#
HostileSexism <- TESS
HostileSexism <- subset(HostileSexism, select=c(HostileSexism1, HostileSexism2, HostileSexism3, HostileSexism4))
psych::alpha(HostileSexism)


###Create Aggregate Benevolent Sexism Measure###
TESS$BenevolentSexism <- (TESS$BenevolentSexism1 + TESS$BenevolentSexism2 + TESS$BenevolentSexism3 + TESS$BenevolentSexism4) / 4

TESS$BenevolentSexism <- rescale(TESS$BenevolentSexism)

#Calculate Cronbach's Alpha (Note: Equals 0.47, which indicates mediocre reliability. Cannot improve if drop any component variable)#
BenevolentSexism <- TESS
BenevolentSexism <- subset(BenevolentSexism, select=c(BenevolentSexism1, BenevolentSexism2, BenevolentSexism3, BenevolentSexism4))
psych::alpha(BenevolentSexism)


### Create Militant Assertiveness Measure###
TESS$MilAssert <- (TESS$MilAssert1 + TESS$MilAssert2 + TESS$MilAssert3) / 3

TESS$MilAssert <- rescale(TESS$MilAssert)

#Calculate Cronbach's Alpha (Note: Equals 0.70, which indicates good reliability. Cannot improve if drop any component variable)#
MilAssert <- TESS
MilAssert <- subset(MilAssert, select=c(MilAssert1, MilAssert2, MilAssert3))
psych::alpha(MilAssert)


###PartyID IQR###
quantile(TESS$PartyID, c(0.25, 0.75), na.rm=TRUE)

TESS$PartyIDIQR <- NA
TESS$PartyIDIQR[TESS$PartyID<=2] <- 0
TESS$PartyIDIQR[TESS$PartyID>=6] <- 1


###Age IQR###
quantile(TESS$Age7, c(0.25, 0.75), na.rm=TRUE)

TESS$AgeIQR <- NA
TESS$AgeIQR[TESS$Age7<=2] <- 0
TESS$AgeIQR[TESS$Age7>=5] <- 1


###Education IQR###
quantile(TESS$Education6, c(0.25, 0.75), na.rm=TRUE)

TESS$EducationIQR <- NA
TESS$EducationIQR[TESS$Education6<=3] <- 0
TESS$EducationIQR[TESS$Education6>=5] <- 1


###Hostile Sexism IQR###
quantile(TESS$HostileSexism, c(0.25, 0.75), na.rm=TRUE)

TESS$HostileSexismIQR <- NA
TESS$HostileSexismIQR[TESS$HostileSexism<=.15] <- 0
TESS$HostileSexismIQR[TESS$HostileSexism>=.50] <- 1


###Benevolent Sexism IQR###
quantile(TESS$BenevolentSexism, c(0.25, 0.75), na.rm=TRUE)

TESS$BenevolentSexismIQR <- NA
TESS$BenevolentSexismIQR[TESS$BenevolentSexism<=.45] <- 0
TESS$BenevolentSexismIQR[TESS$BenevolentSexism>=.70] <- 1


###Militant Assertiveness IQR###
quantile(TESS$MilAssert, c(0.25, 0.75), na.rm=TRUE)

TESS$MilAssertIQR <- NA
TESS$MilAssertIQR[TESS$MilAssert<=.333] <- 0
TESS$MilAssertIQR[TESS$MilAssert>=.666] <- 1


#####Create dataset without those who got more than one attention check question wrong####
TESS2 <- subset(TESS, AttentionCheck>=2) 

#####Table S.2#####

##Bootstrapped Difference in Means##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, nrow=B, ncol=24)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$DisapprovalBinary[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$DisapprovalBinary[which(temp$Engage==1)], na.rm=TRUE)
    D <- mean(temp$DisapprovalBinary[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    E <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    G <- mean(temp$DisapprovalBinary[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    H <- mean(temp$DisapprovalBinary[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    I <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    J <- mean(temp$DisapprovalBinary[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)   
    K <- mean(temp$DisapprovalBinary[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    L <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    M <- mean(temp$DisapprovalBinary[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)      
    N <- mean(temp$DisapprovalBinary[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    O <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    P <- mean(temp$DisapprovalBinary[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)     
    bootResults[i,1] <- (B-A)
    bootResults[i,2] <- (C-A)
    bootResults[i,3] <- (B-C)  
    bootResults[i,4] <- (E-D)
    bootResults[i,5] <- (G-D)
    bootResults[i,6] <- (E-G)  
    bootResults[i,7] <- (I-H)
    bootResults[i,8] <- (J-H)
    bootResults[i,9] <- (I-J)  
    bootResults[i,10] <- (L-K)
    bootResults[i,11] <- (M-K)
    bootResults[i,12] <- (L-M)  
    bootResults[i,13] <- (O-N)
    bootResults[i,14] <- (P-N)
    bootResults[i,15] <- (O-P)  
    bootResults[i,16] <- (I-H) - (E-D) 
    bootResults[i,17] <- (J-H) - (G-D) 
    bootResults[i,18] <- (I-J) - (E-G) 
    bootResults[i,19] <- (L-K) - (E-D) 
    bootResults[i,20] <- (M-K) - (G-D) 
    bootResults[i,21] <- (L-M) - (E-G) 
    bootResults[i,22] <- (O-N) - (E-D) 
    bootResults[i,23] <- (P-N) - (G-D) 
    bootResults[i,24] <- (O-P) - (E-G) 
    drop(list())
  }
  return(list(model=label, boot=bootResults, AC.Full=mean(bootResults[,1], na.rm=TRUE), 
              BC.Full=mean(bootResults[,2], na.rm=TRUE), IC.Full=mean(bootResults[,3], na.rm=TRUE), 
              AC.MM=mean(bootResults[,4], na.rm=TRUE), BC.MM=mean(bootResults[,5], na.rm=TRUE), 
              IC.MM=mean(bootResults[,6], na.rm=TRUE), AC.MF=mean(bootResults[,7], na.rm=TRUE), 
              BC.MF=mean(bootResults[,8], na.rm=TRUE), IC.MF=mean(bootResults[,9], na.rm=TRUE),
              AC.FF=mean(bootResults[,10], na.rm=TRUE), BC.FF=mean(bootResults[,11], na.rm=TRUE), 
              IC.FF=mean(bootResults[,12], na.rm=TRUE), AC.FM=mean(bootResults[,13], na.rm=TRUE), 
              BC.FM=mean(bootResults[,14], na.rm=TRUE), IC.FM=mean(bootResults[,15], na.rm=TRUE),
              AC.MFControl=mean(bootResults[,16], na.rm=TRUE), BC.MFControl=mean(bootResults[,17], na.rm=TRUE),
              IC.MFControl=mean(bootResults[,18], na.rm=TRUE), AC.FFControl=mean(bootResults[,19], na.rm=TRUE),
              BC.FFControl=mean(bootResults[,20], na.rm=TRUE), IC.FFControl=mean(bootResults[,21], na.rm=TRUE),
              AC.FMControl=mean(bootResults[,22], na.rm=TRUE), BC.FMControl=mean(bootResults[,23], na.rm=TRUE),
              IC.FMControl=mean(bootResults[,24], na.rm=TRUE)))
}

full.2 <- bootTreat2(TESS)

##FM Audience Costs Relative to the MM Control##
round(c(full.2$AC.FMControl, quantile(full.2$boot[,22], c(0.025, 0.975))), digits=3)
#FM Audience Costs#
round(c(full.2$AC.FM, quantile(full.2$boot[,13], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FF Audience Costs Relative to the MM Control##
round(c(full.2$AC.FFControl, quantile(full.2$boot[,19], c(0.025, 0.975))), digits=3)
#FF Audience Costs#
round(c(full.2$AC.FF, quantile(full.2$boot[,10], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##MF Audience Costs Relative to the MM Control##
round(c(full.2$AC.MFControl, quantile(full.2$boot[,16], c(0.025, 0.975))), digits=3)
#MF Audience Costs#
round(c(full.2$AC.MF, quantile(full.2$boot[,7], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FM Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FMControl, quantile(full.2$boot[,24], c(0.025, 0.975))), digits=3)
#FM Inconsistency Costs#
round(c(full.2$IC.FM, quantile(full.2$boot[,15], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FFControl, quantile(full.2$boot[,21], c(0.025, 0.975))), digits=3)
#FF Inconsistency Costs#
round(c(full.2$IC.FF, quantile(full.2$boot[,12], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##MF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.MFControl, quantile(full.2$boot[,18], c(0.025, 0.975))), digits=3)
#MF Inconsistency Costs#
round(c(full.2$IC.MF, quantile(full.2$boot[,9], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FM Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FMControl, quantile(full.2$boot[,23], c(0.025, 0.975))), digits=3)
#FM Belligerence Costs#
round(c(full.2$BC.FM, quantile(full.2$boot[,14], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##FF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FFControl, quantile(full.2$boot[,20], c(0.025, 0.975))), digits=3)
#FF Belligerence Costs#
round(c(full.2$BC.FF, quantile(full.2$boot[,11], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##MF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.MFControl, quantile(full.2$boot[,17], c(0.025, 0.975))), digits=3)
#MF Belligerence Costs#
round(c(full.2$BC.MF, quantile(full.2$boot[,8], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##P-Values for Audience Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$DisapprovalBinary[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$DisapprovalBinary[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)

##P-Values for Inconsistency Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$DisapprovalBinary[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$DisapprovalBinary[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-C)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)

##P-Values for Belligerence Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$DisapprovalBinary[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$DisapprovalBinary[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$DisapprovalBinary[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (C-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(FM, MM)
#FF P-Value#
p.calc(FF, MM)
#MF P-Value#
p.calc(MF, MM)



#####Table S.3#####

##Bootstrapped Difference in Means##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, nrow=B, ncol=24)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    D <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    E <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    G <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    H <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    I <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    J <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)   
    K <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    L <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    M <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)      
    N <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    O <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    P <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)     
    bootResults[i,1] <- (B-A)
    bootResults[i,2] <- (C-A)
    bootResults[i,3] <- (B-C)  
    bootResults[i,4] <- (E-D)
    bootResults[i,5] <- (G-D)
    bootResults[i,6] <- (E-G)  
    bootResults[i,7] <- (I-H)
    bootResults[i,8] <- (J-H)
    bootResults[i,9] <- (I-J)  
    bootResults[i,10] <- (L-K)
    bootResults[i,11] <- (M-K)
    bootResults[i,12] <- (L-M)  
    bootResults[i,13] <- (O-N)
    bootResults[i,14] <- (P-N)
    bootResults[i,15] <- (O-P)  
    bootResults[i,16] <- (I-H) - (E-D) 
    bootResults[i,17] <- (J-H) - (G-D) 
    bootResults[i,18] <- (I-J) - (E-G) 
    bootResults[i,19] <- (L-K) - (E-D) 
    bootResults[i,20] <- (M-K) - (G-D) 
    bootResults[i,21] <- (L-M) - (E-G) 
    bootResults[i,22] <- (O-N) - (E-D) 
    bootResults[i,23] <- (P-N) - (G-D) 
    bootResults[i,24] <- (O-P) - (E-G) 
    drop(list())
  }
  return(list(model=label, boot=bootResults, AC.Full=mean(bootResults[,1], na.rm=TRUE), 
              BC.Full=mean(bootResults[,2], na.rm=TRUE), IC.Full=mean(bootResults[,3], na.rm=TRUE), 
              AC.MM=mean(bootResults[,4], na.rm=TRUE), BC.MM=mean(bootResults[,5], na.rm=TRUE), 
              IC.MM=mean(bootResults[,6], na.rm=TRUE), AC.MF=mean(bootResults[,7], na.rm=TRUE), 
              BC.MF=mean(bootResults[,8], na.rm=TRUE), IC.MF=mean(bootResults[,9], na.rm=TRUE),
              AC.FF=mean(bootResults[,10], na.rm=TRUE), BC.FF=mean(bootResults[,11], na.rm=TRUE), 
              IC.FF=mean(bootResults[,12], na.rm=TRUE), AC.FM=mean(bootResults[,13], na.rm=TRUE), 
              BC.FM=mean(bootResults[,14], na.rm=TRUE), IC.FM=mean(bootResults[,15], na.rm=TRUE),
              AC.MFControl=mean(bootResults[,16], na.rm=TRUE), BC.MFControl=mean(bootResults[,17], na.rm=TRUE),
              IC.MFControl=mean(bootResults[,18], na.rm=TRUE), AC.FFControl=mean(bootResults[,19], na.rm=TRUE),
              BC.FFControl=mean(bootResults[,20], na.rm=TRUE), IC.FFControl=mean(bootResults[,21], na.rm=TRUE),
              AC.FMControl=mean(bootResults[,22], na.rm=TRUE), BC.FMControl=mean(bootResults[,23], na.rm=TRUE),
              IC.FMControl=mean(bootResults[,24], na.rm=TRUE)))
}

full.2 <- bootTreat2(TESS2)

##FM Audience Costs Relative to the MM Control##
round(c(full.2$AC.FMControl, quantile(full.2$boot[,22], c(0.025, 0.975))), digits=3)
#FM Audience Costs#
round(c(full.2$AC.FM, quantile(full.2$boot[,13], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FF Audience Costs Relative to the MM Control##
round(c(full.2$AC.FFControl, quantile(full.2$boot[,19], c(0.025, 0.975))), digits=3)
#FF Audience Costs#
round(c(full.2$AC.FF, quantile(full.2$boot[,10], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##MF Audience Costs Relative to the MM Control##
round(c(full.2$AC.MFControl, quantile(full.2$boot[,16], c(0.025, 0.975))), digits=3)
#MF Audience Costs#
round(c(full.2$AC.MF, quantile(full.2$boot[,7], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FM Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FMControl, quantile(full.2$boot[,24], c(0.025, 0.975))), digits=3)
#FM Inconsistency Costs#
round(c(full.2$IC.FM, quantile(full.2$boot[,15], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FFControl, quantile(full.2$boot[,21], c(0.025, 0.975))), digits=3)
#FF Inconsistency Costs#
round(c(full.2$IC.FF, quantile(full.2$boot[,12], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##MF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.MFControl, quantile(full.2$boot[,18], c(0.025, 0.975))), digits=3)
#MF Inconsistency Costs#
round(c(full.2$IC.MF, quantile(full.2$boot[,9], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FM Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FMControl, quantile(full.2$boot[,23], c(0.025, 0.975))), digits=3)
#FM Belligerence Costs#
round(c(full.2$BC.FM, quantile(full.2$boot[,14], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##FF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FFControl, quantile(full.2$boot[,20], c(0.025, 0.975))), digits=3)
#FF Belligerence Costs#
round(c(full.2$BC.FF, quantile(full.2$boot[,11], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##MF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.MFControl, quantile(full.2$boot[,17], c(0.025, 0.975))), digits=3)
#MF Belligerence Costs#
round(c(full.2$BC.MF, quantile(full.2$boot[,8], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)


##P-Values for Audience Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==0))
FM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==0))
MF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==1))
FF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==1))
Full <- bootTreat2(subset(TESS2))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Inconsistency Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-C)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==0))
FM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==0))
MF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==1))
FF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==1))
Full <- bootTreat2(subset(TESS2))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Belligerence Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (C-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==0))
FM <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==0))
MF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==0 & TESS2$FemaleOpp==1))
FF <- bootTreat2(subset(TESS2, TESS2$FemaleUS==1 & TESS2$FemaleOpp==1))
Full <- bootTreat2(subset(TESS2))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(FM, MM)
#FF P-Value#
p.calc(FF, MM)
#MF P-Value#
p.calc(MF, MM)



#####Table S.4#####

##Bootstrapped Difference in Means##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, nrow=B, ncol=24)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    D <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    E <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    G <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    H <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    I <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    J <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)   
    K <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    L <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    M <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)      
    N <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    O <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    P <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)     
    bootResults[i,1] <- (B-A)
    bootResults[i,2] <- (C-A)
    bootResults[i,3] <- (B-C)  
    bootResults[i,4] <- (E-D)
    bootResults[i,5] <- (G-D)
    bootResults[i,6] <- (E-G)  
    bootResults[i,7] <- (I-H)
    bootResults[i,8] <- (J-H)
    bootResults[i,9] <- (I-J)  
    bootResults[i,10] <- (L-K)
    bootResults[i,11] <- (M-K)
    bootResults[i,12] <- (L-M)  
    bootResults[i,13] <- (O-N)
    bootResults[i,14] <- (P-N)
    bootResults[i,15] <- (O-P)  
    bootResults[i,16] <- (I-H) - (E-D) 
    bootResults[i,17] <- (J-H) - (G-D) 
    bootResults[i,18] <- (I-J) - (E-G) 
    bootResults[i,19] <- (L-K) - (E-D) 
    bootResults[i,20] <- (M-K) - (G-D) 
    bootResults[i,21] <- (L-M) - (E-G) 
    bootResults[i,22] <- (O-N) - (E-D) 
    bootResults[i,23] <- (P-N) - (G-D) 
    bootResults[i,24] <- (O-P) - (E-G) 
    drop(list())
  }
  return(list(model=label, boot=bootResults, AC.Full=mean(bootResults[,1], na.rm=TRUE), 
              BC.Full=mean(bootResults[,2], na.rm=TRUE), IC.Full=mean(bootResults[,3], na.rm=TRUE), 
              AC.MM=mean(bootResults[,4], na.rm=TRUE), BC.MM=mean(bootResults[,5], na.rm=TRUE), 
              IC.MM=mean(bootResults[,6], na.rm=TRUE), AC.MF=mean(bootResults[,7], na.rm=TRUE), 
              BC.MF=mean(bootResults[,8], na.rm=TRUE), IC.MF=mean(bootResults[,9], na.rm=TRUE),
              AC.FF=mean(bootResults[,10], na.rm=TRUE), BC.FF=mean(bootResults[,11], na.rm=TRUE), 
              IC.FF=mean(bootResults[,12], na.rm=TRUE), AC.FM=mean(bootResults[,13], na.rm=TRUE), 
              BC.FM=mean(bootResults[,14], na.rm=TRUE), IC.FM=mean(bootResults[,15], na.rm=TRUE),
              AC.MFControl=mean(bootResults[,16], na.rm=TRUE), BC.MFControl=mean(bootResults[,17], na.rm=TRUE),
              IC.MFControl=mean(bootResults[,18], na.rm=TRUE), AC.FFControl=mean(bootResults[,19], na.rm=TRUE),
              BC.FFControl=mean(bootResults[,20], na.rm=TRUE), IC.FFControl=mean(bootResults[,21], na.rm=TRUE),
              AC.FMControl=mean(bootResults[,22], na.rm=TRUE), BC.FMControl=mean(bootResults[,23], na.rm=TRUE),
              IC.FMControl=mean(bootResults[,24], na.rm=TRUE)))
}

full.2 <- bootTreat2(TESS)

##FM Audience Costs Relative to the MM Control##
round(c(full.2$AC.FMControl, quantile(full.2$boot[,22], c(0.025, 0.975))), digits=3)
#FM Audience Costs#
round(c(full.2$AC.FM, quantile(full.2$boot[,13], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FF Audience Costs Relative to the MM Control##
round(c(full.2$AC.FFControl, quantile(full.2$boot[,19], c(0.025, 0.975))), digits=3)
#FF Audience Costs#
round(c(full.2$AC.FF, quantile(full.2$boot[,10], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##MF Audience Costs Relative to the MM Control##
round(c(full.2$AC.MFControl, quantile(full.2$boot[,16], c(0.025, 0.975))), digits=3)
#MF Audience Costs#
round(c(full.2$AC.MF, quantile(full.2$boot[,7], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FM Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FMControl, quantile(full.2$boot[,24], c(0.025, 0.975))), digits=3)
#FM Inconsistency Costs#
round(c(full.2$IC.FM, quantile(full.2$boot[,15], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FFControl, quantile(full.2$boot[,21], c(0.025, 0.975))), digits=3)
#FF Inconsistency Costs#
round(c(full.2$IC.FF, quantile(full.2$boot[,12], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##MF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.MFControl, quantile(full.2$boot[,18], c(0.025, 0.975))), digits=3)
#MF Inconsistency Costs#
round(c(full.2$IC.MF, quantile(full.2$boot[,9], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FM Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FMControl, quantile(full.2$boot[,23], c(0.025, 0.975))), digits=3)
#FM Belligerence Costs#
round(c(full.2$BC.FM, quantile(full.2$boot[,14], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##FF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FFControl, quantile(full.2$boot[,20], c(0.025, 0.975))), digits=3)
#FF Belligerence Costs#
round(c(full.2$BC.FF, quantile(full.2$boot[,11], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##MF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.MFControl, quantile(full.2$boot[,17], c(0.025, 0.975))), digits=3)
#MF Belligerence Costs#
round(c(full.2$BC.MF, quantile(full.2$boot[,8], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)


##P-Values for Audience Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Inconsistency Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-C)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Belligerence Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (C-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==0))
FM <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==0))
MF <- bootTreat2(subset(TESS, TESS$FemaleUS==0 & TESS$FemaleOpp==1))
FF <- bootTreat2(subset(TESS, TESS$FemaleUS==1 & TESS$FemaleOpp==1))
Full <- bootTreat2(subset(TESS))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(FM, MM)
#FF P-Value#
p.calc(FF, MM)
#MF P-Value#
p.calc(MF, MM)



#####Table S.5#####

###Column 1###
reg.IC1 <- lm(TESS2$Disapproval ~ MM_StayOut + MM_NotEngage + FM_StayOut + FM_NotEngage + 
                FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism +
                MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.IC1)

##Differences in Inconsistency Costs for the FM, MF, and FF Dyads Compared to MM Baseline, and Associated P-values##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC1 <- matrix(NA, B,length(coef(reg.IC1))) 
colnames(storageIC1) <- names(coef(reg.IC1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut + MM_NotEngage + FM_StayOut + FM_NotEngage + FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC1[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC1 <- array(NA, dim=c(B,7,length(m)), dimnames=list(NULL, c("MM","MF","FM","FF", "MF_Control", "FM_Control", "FF_Control"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC1[,1,i] <- storageIC1[,3] 
  parsIC1[,2,i] <- storageIC1[,8] - (storageIC1[,9])
  parsIC1[,3,i] <- storageIC1[,5] - (storageIC1[,6])
  parsIC1[,4,i] <-  storageIC1[,11] - (storageIC1[,12])
  parsIC1[,5,i] <-  (parsIC1[,2,i]) - (parsIC1[,1,i])
  parsIC1[,6,i] <-  (parsIC1[,3,i]) - (parsIC1[,1,i])
  parsIC1[,7,i] <-  (parsIC1[,4,i]) - (parsIC1[,1,i])
}	

#FM Compared to Control#
mean(parsIC1[,6,i])
1- length(which(parsIC1[,6,i] > 0))/nrow(parsIC1)
#MF Compared to Control#
mean(parsIC1[,5,i])
1- length(which(parsIC1[,5,i] > 0))/nrow(parsIC1)
#FF Compared to Control#
mean(parsIC1[,7,i])
1- length(which(parsIC1[,7,i] > 0))/nrow(parsIC1)

###Column 2###
reg.IC2 <- lm(TESS$Disapproval ~ MM_StayOut + MM_NotEngage + FM_StayOut + FM_NotEngage + 
                FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism +
                MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.IC2)

##Differences in Inconsistency Costs for the FM, MF, and FF Dyads Compared to MM Baseline, and Associated P-values##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC2 <- matrix(NA, B,length(coef(reg.IC2))) 
colnames(storageIC2) <- names(coef(reg.IC2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut + MM_NotEngage + FM_StayOut + FM_NotEngage + FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC2[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC2 <- array(NA, dim=c(B,7,length(m)), dimnames=list(NULL, c("MM","MF","FM","FF", "MF_Control", "FM_Control", "FF_Control"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC2[,1,i] <- storageIC2[,3] 
  parsIC2[,2,i] <- storageIC2[,8] - (storageIC2[,9])
  parsIC2[,3,i] <- storageIC2[,5] - (storageIC2[,6])
  parsIC2[,4,i] <-  storageIC2[,11] - (storageIC2[,12])
  parsIC2[,5,i] <-  (parsIC2[,2,i]) - (parsIC2[,1,i])
  parsIC2[,6,i] <-  (parsIC2[,3,i]) - (parsIC2[,1,i])
  parsIC2[,7,i] <-  (parsIC2[,4,i]) - (parsIC2[,1,i])
}	

#FM Compared to Control#
mean(parsIC2[,6,i])
1- length(which(parsIC2[,6,i] > 0))/nrow(parsIC2)
#MF Compared to Control#
mean(parsIC2[,5,i])
1- length(which(parsIC2[,5,i] > 0))/nrow(parsIC2)
#FF Compared to Control#
mean(parsIC2[,7,i])
1- length(which(parsIC2[,7,i] > 0))/nrow(parsIC2)

###Column 3###
reg.BC1 <- lm(Disapproval ~ MM_NotEngage + MM_Engage + FM_StayOut + FM_NotEngage + 
                FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism + 
                MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.BC1)

##Differences in Belligerence Costs for the FM, MF, and FF Dyads Compared to MM Baseline, and Associated P-values##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageBC1 <- matrix(NA, B,length(coef(reg.BC1))) 
colnames(storageBC1) <- names(coef(reg.BC1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_NotEngage + MM_Engage + FM_StayOut + FM_NotEngage + 
                   FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                   FF_NotEngage + FF_Engage +  + DemocratUS + HostileSexism + BenevolentSexism + 
                   MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                   RegimeConfounding + NonWhiteConfounding, data=temp)
  storageBC1[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsBC1 <- array(NA, dim=c(B,7,length(m)), dimnames=list(NULL, c("MM","MF","FM","FF", "MF_Control", "FM_Control", "FF_Control"), round(m,digits=3)))
for (i in 1:length(m)){
  parsBC1[,1,i] <- storageBC1[,3] 
  parsBC1[,2,i] <- storageBC1[,9] - (storageBC1[,7])
  parsBC1[,3,i] <- storageBC1[,6] - (storageBC1[,4])
  parsBC1[,4,i] <-  storageBC1[,12] - (storageBC1[,10])
  parsBC1[,5,i] <-  (parsBC1[,2,i]) - (parsBC1[,1,i])
  parsBC1[,6,i] <-  (parsBC1[,3,i]) - (parsBC1[,1,i])
  parsBC1[,7,i] <-  (parsBC1[,4,i]) - (parsBC1[,1,i])
}	

#FM Compared to Control#
mean(parsBC1[,6,i])
1- length(which(parsBC1[,6,i] < 0))/nrow(parsBC1)
#MF Compared to Control#
mean(parsBC1[,5,i])
1- length(which(parsBC1[,5,i] < 0))/nrow(parsBC1)
#FF Compared to Control#
mean(parsBC1[,7,i])
1- length(which(parsBC1[,7,i] < 0))/nrow(parsBC1)

###Column 4###
reg.BC2 <- lm(Disapproval ~ MM_NotEngage + MM_Engage + FM_StayOut + FM_NotEngage + 
                FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                FF_NotEngage + FF_Engage + DemocratUS + HostileSexism + BenevolentSexism + 
                MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.BC2)

##Differences in Belligerence Costs for the FM, MF, and FF Dyads Compared to MM Baseline, and Associated P-values##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageBC2 <- matrix(NA, B,length(coef(reg.BC2))) 
colnames(storageBC2) <- names(coef(reg.BC2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_NotEngage + MM_Engage + FM_StayOut + FM_NotEngage + 
                   FM_Engage + MF_StayOut + MF_NotEngage + MF_Engage + FF_StayOut + 
                   FF_NotEngage + FF_Engage +  + DemocratUS + HostileSexism + BenevolentSexism + 
                   MilAssert + PartyID + Gender + Age4 + Education5 + Income6 + SexismOrder + 
                   RegimeConfounding + NonWhiteConfounding, data=temp)
  storageBC2[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsBC2 <- array(NA, dim=c(B,7,length(m)), dimnames=list(NULL, c("MM","MF","FM","FF", "MF_Control", "FM_Control", "FF_Control"), round(m,digits=3)))
for (i in 1:length(m)){
  parsBC2[,1,i] <- storageBC2[,3] 
  parsBC2[,2,i] <- storageBC2[,9] - (storageBC2[,7])
  parsBC2[,3,i] <- storageBC2[,6] - (storageBC2[,4])
  parsBC2[,4,i] <-  storageBC2[,12] - (storageBC2[,10])
  parsBC2[,5,i] <-  (parsBC2[,2,i]) - (parsBC2[,1,i])
  parsBC2[,6,i] <-  (parsBC2[,3,i]) - (parsBC2[,1,i])
  parsBC2[,7,i] <-  (parsBC2[,4,i]) - (parsBC2[,1,i])
}	

#FM Compared to Control#
mean(parsBC2[,6,i])
1- length(which(parsBC2[,6,i] < 0))/nrow(parsBC2)
#MF Compared to Control#
mean(parsBC2[,5,i])
1- length(which(parsBC2[,5,i] < 0))/nrow(parsBC2)
#FF Compared to Control#
mean(parsBC2[,7,i])
1- length(which(parsBC2[,7,i] < 0))/nrow(parsBC2)




#####Table S.6#####

###Column 1###
reg.MA1 <- lm(TESS2$Disapproval ~ NotEngage + Engage + NotEngage*MilAssertIQR + Engage*MilAssertIQR + 
                FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssertIQR + PartyID + 
                Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.MA1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageMA <- matrix(NA, B,length(coef(reg.MA1))) 
colnames(storageMA) <- names(coef(reg.MA1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ NotEngage + Engage + NotEngage*MilAssertIQR + Engage*MilAssertIQR + 
                   FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssertIQR + PartyID + 
                   Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageMA[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsMA <- array(NA, dim=c(B,5,length(m)), dimnames=list(NULL, c("A-B","B-C","A-C","A-B/A-C", "B-C/A-C"), round(m,digits=2)))
for (i in 1:length(m)){
  parsMA[,1,i] <- storageMA[,2] - storageMA[,3] + (storageMA[,18]-storageMA[,19])*m[i]
  parsMA[,2,i] <- storageMA[,3] + (storageMA[,19])*m[i]
  parsMA[,3,i] <- storageMA[,2] + (storageMA[,18])*m[i]
  parsMA[,4,i] <- (parsMA[,1,i])/(parsMA[,3,i])
  parsMA[,5,i] <- (parsMA[,2,i])/(parsMA[,3,i])
}	

##Inconsistency Cost Fraction##
#Low in Militant Assertiveness#
mean(parsMA[,4,1])
#High in Militant Assertiveness#
mean(parsMA[,4,2])
#P-Value#
1- length(which(parsMA[,4,1] < parsMA[,4,2]))/nrow(parsMA)

###Column 2###
reg.MA2 <- lm(TESS$Disapproval ~ NotEngage + Engage + NotEngage*MilAssertIQR + Engage*MilAssertIQR + 
                FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssertIQR + PartyID + 
                Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.MA2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageMA <- matrix(NA, B,length(coef(reg.MA2))) 
colnames(storageMA) <- names(coef(reg.MA2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ NotEngage + Engage + NotEngage*MilAssertIQR + Engage*MilAssertIQR + 
                   FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssertIQR + PartyID + 
                   Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageMA[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsMA <- array(NA, dim=c(B,5,length(m)), dimnames=list(NULL, c("A-B","B-C","A-C","A-B/A-C", "B-C/A-C"), round(m,digits=2)))
for (i in 1:length(m)){
  parsMA[,1,i] <- storageMA[,2] - storageMA[,3] + (storageMA[,18]-storageMA[,19])*m[i]
  parsMA[,2,i] <- storageMA[,3] + (storageMA[,19])*m[i]
  parsMA[,3,i] <- storageMA[,2] + (storageMA[,18])*m[i]
  parsMA[,4,i] <- (parsMA[,1,i])/(parsMA[,3,i])
  parsMA[,5,i] <- (parsMA[,2,i])/(parsMA[,3,i])
}	

##Inconsistency Cost Fraction##
#Low in Militant Assertiveness#
mean(parsMA[,4,1])
#High in Militant Assertiveness#
mean(parsMA[,4,2])
#P-Value#
1- length(which(parsMA[,4,1] < parsMA[,4,2]))/nrow(parsMA)

###Column 3###
TESS2$Republican <- 0
TESS2$Republican[TESS2$PartyID<4] <- 1

reg.PID1 <- lm(TESS2$Disapproval ~ NotEngage + Engage + NotEngage*Republican + Engage*Republican + 
                 FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Republican + 
                 Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.PID1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storagePID <- matrix(NA, B,length(coef(reg.PID1))) 
colnames(storagePID) <- names(coef(reg.PID1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ NotEngage + Engage + NotEngage*Republican + Engage*Republican + 
                   FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Republican + 
                   Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storagePID[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsPID <- array(NA, dim=c(B,5,length(m)), dimnames=list(NULL, c("A-B","B-C","A-C","A-B/A-C", "B-C/A-C"), round(m,digits=2)))
for (i in 1:length(m)){
  parsPID[,1,i] <- storagePID[,2] - storagePID[,3] + (storagePID[,18]-storagePID[,19])*m[i]
  parsPID[,2,i] <- storagePID[,3] + (storagePID[,19])*m[i]
  parsPID[,3,i] <- storagePID[,2] + (storagePID[,18])*m[i]
  parsPID[,4,i] <- (parsPID[,1,i])/(parsPID[,3,i])
  parsPID[,5,i] <- (parsPID[,2,i])/(parsPID[,3,i])
}	

##Inconsistency Cost Fraction##
#Democrats#
mean(parsPID[,4,1])
#Republicans#
mean(parsPID[,4,2])
#P-Value#
1- length(which(parsPID[,4,1] < parsPID[,4,2]))/nrow(parsPID)

###Column 4###
TESS$Republican <- 0
TESS$Republican[TESS$PartyID<4] <- 1

reg.PID2 <- lm(TESS$Disapproval ~ NotEngage + Engage + NotEngage*Republican + Engage*Republican + 
                 FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Republican + 
                 Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.PID2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storagePID <- matrix(NA, B,length(coef(reg.PID2))) 
colnames(storagePID) <- names(coef(reg.PID2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ NotEngage + Engage + NotEngage*Republican + Engage*Republican + 
                   FemaleOpp + FemaleUS + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Republican + 
                   Gender + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storagePID[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsPID <- array(NA, dim=c(B,5,length(m)), dimnames=list(NULL, c("A-B","B-C","A-C","A-B/A-C", "B-C/A-C"), round(m,digits=2)))
for (i in 1:length(m)){
  parsPID[,1,i] <- storagePID[,2] - storagePID[,3] + (storagePID[,18]-storagePID[,19])*m[i]
  parsPID[,2,i] <- storagePID[,3] + (storagePID[,19])*m[i]
  parsPID[,3,i] <- storagePID[,2] + (storagePID[,18])*m[i]
  parsPID[,4,i] <- (parsPID[,1,i])/(parsPID[,3,i])
  parsPID[,5,i] <- (parsPID[,2,i])/(parsPID[,3,i])
}	

##Inconsistency Cost Fraction##
#Democrats#
mean(parsPID[,4,1])
#Republicans#
mean(parsPID[,4,2])
#P-Value#
1- length(which(parsPID[,4,1] < parsPID[,4,2]))/nrow(parsPID)




#####Table S.7#####

###Column 1###
reg.BenevSex1 <- lm(TESS2$Disapproval ~ MM_StayOut*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + 
                      FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + 
                      FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + Education5 + HostileSexism +
                      MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                      RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.BenevSex1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.BenevSex1))) 
colnames(storageIC) <- names(coef(reg.BenevSex1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + HostileSexism + Age4 + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowBenevolentSexism","MFLowBenevolentSexism","FFLowBenevolentSexism","FMHighBenevolentSexism","MFHighBenevolentSexism","FFHighBenevolentSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Benevolent Sexism#
mean(parsIC[,1,i])
#FM High Benevolent Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Low Benevolent Sexism#
mean(parsIC[,2,i])
#MF High Benevolent Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Low Benevolent Sexism#
mean(parsIC[,3,i])
#FF High Benevolent Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 2###
reg.BenevSex2 <- lm(TESS$Disapproval ~ MM_StayOut*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + 
                      FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + 
                      FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + Education5 + HostileSexism +
                      MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                      RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.BenevSex2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.BenevSex2))) 
colnames(storageIC) <- names(coef(reg.BenevSex2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + HostileSexism + Age4 + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowBenevolentSexism","MFLowBenevolentSexism","FFLowBenevolentSexism","FMHighBenevolentSexism","MFHighBenevolentSexism","FFHighBenevolentSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Benevolent Sexism#
mean(parsIC[,1,i])
#FM High Benevolent Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Low Benevolent Sexism#
mean(parsIC[,2,i])
#MF High Benevolent Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Low Benevolent Sexism#
mean(parsIC[,3,i])
#FF High Benevolent Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 3###
reg.HosSex1 <- lm(TESS2$Disapproval ~ MM_StayOut*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + 
                    FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + 
                    FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Education5 + BenevolentSexism +
                    MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.HosSex1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.HosSex1))) 
colnames(storageIC) <- names(coef(reg.HosSex1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Age4 + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowHostileSexism","MFLowHostileSexism","FFLowHostileSexism","FMHighHostileSexism","MFHighHostileSexism","FFHighHostileSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Hostile Sexism#
mean(parsIC[,1,i])
#FM High Hostile Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Low Hostile Sexism#
mean(parsIC[,2,i])
#MF High Hostile Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Low Hostile Sexism#
mean(parsIC[,3,i])
#FF High Hostile Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference #
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 4###
reg.HosSex2 <- lm(TESS$Disapproval ~ MM_StayOut*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + 
                    FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + 
                    FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Education5 + BenevolentSexism +
                    MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.HosSex2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.HosSex2))) 
colnames(storageIC) <- names(coef(reg.HosSex2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Age4 + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowHostileSexism","MFLowHostileSexism","FFLowHostileSexism","FMHighHostileSexism","MFHighHostileSexism","FFHighHostileSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Hostile Sexism#
mean(parsIC[,1,i])
#FM High Hostile Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Low Hostile Sexism#
mean(parsIC[,2,i])
#MF High Hostile Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Low Hostile Sexism#
mean(parsIC[,3,i])
#FF High Hostile Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 5###
reg.Age1 <- lm(TESS2$Disapproval ~ MM_StayOut*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + 
                 FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + 
                 FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.Age1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Age1))) 
colnames(storageIC) <- names(coef(reg.Age1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMYoung","MFYoung","FFYoung","FMOld","MFOld","FFOld", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Young#
mean(parsIC[,1,i])
#FM Old#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Young#
mean(parsIC[,2,i])
#MF Old#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Young#
mean(parsIC[,3,i])
#FF Old#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 6###
reg.Age2 <- lm(TESS$Disapproval ~ MM_StayOut*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + 
                 FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + 
                 FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.Age2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Age2))) 
colnames(storageIC) <- names(coef(reg.Age2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMYoung","MFYoung","FFYoung","FMOld","MFOld","FFOld", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Young#
mean(parsIC[,1,i])
#FM Old#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Young#
mean(parsIC[,2,i])
#MF Old#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Young#
mean(parsIC[,3,i])
#FF Old#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 7###
reg.PID1 <- lm(TESS2$Disapproval ~ MM_StayOut*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + 
                 FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + 
                 FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.PID1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.PID1))) 
colnames(storageIC) <- names(coef(reg.PID1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Republican#
mean(parsIC[,1,i])
#FM Democrat#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Republican#
mean(parsIC[,2,i])
#MF Democrat#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Republican#
mean(parsIC[,3,i])
#FF Democrat#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 8###
reg.PID2 <- lm(TESS$Disapproval ~ MM_StayOut*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + 
                 FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + 
                 FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.PID2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.PID2))) 
colnames(storageIC) <- names(coef(reg.PID2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Republican#
mean(parsIC[,1,i])
#FM Democrat#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Republican#
mean(parsIC[,2,i])
#MF Democrat#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Republican#
mean(parsIC[,3,i])
#FF Democrat#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 9###
reg.Gender1 <- lm(TESS2$Disapproval ~ MM_StayOut*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + 
                    FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + 
                    FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism +
                    MilAssert + Age4 + PartyID + Education5 + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.Gender1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Gender1))) 
colnames(storageIC) <- names(coef(reg.Gender1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + PartyID + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Male#
mean(parsIC[,1,i])
#FM Female#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Male#
mean(parsIC[,2,i])
#MF Female#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Male#
mean(parsIC[,3,i])
#FF Female#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 10###
reg.Gender2 <- lm(TESS$Disapproval ~ MM_StayOut*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + 
                    FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + 
                    FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism +
                    MilAssert + Age4 + PartyID + Education5 + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.Gender2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Gender2))) 
colnames(storageIC) <- names(coef(reg.Gender2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_StayOut*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + PartyID + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,6] - storageIC[,7]) - (storageIC[,4]) 
  parsIC[,2,i] <- (storageIC[,9] - storageIC[,10]) - (storageIC[,4]) 
  parsIC[,3,i] <- (storageIC[,12] - storageIC[,13]) - (storageIC[,4]) 
  parsIC[,4,i] <- ((storageIC[,6] - storageIC[,7]) + (storageIC[,28] - storageIC[,29])) - (storageIC[,26] + storageIC[,4])
  parsIC[,5,i] <- ((storageIC[,9] - storageIC[,10]) + (storageIC[,31] - storageIC[,32])) - (storageIC[,26] + storageIC[,4])
  parsIC[,6,i] <- ((storageIC[,12] - storageIC[,13]) + (storageIC[,34] - storageIC[,35])) - (storageIC[,26] + storageIC[,4])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Male#
mean(parsIC[,1,i])
#FM Female#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Male#
mean(parsIC[,2,i])
#MF female#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Male#
mean(parsIC[,3,i])
#FF Female#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)



#####Table S.8#####

###Column 1###
reg.BenevSex1 <- lm(TESS2$Disapproval ~ MM_Engage*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + 
                      FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + 
                      FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + Education5 + HostileSexism +
                      MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                      RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.BenevSex1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.BenevSex1))) 
colnames(storageIC) <- names(coef(reg.BenevSex1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + HostileSexism + Age4 + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowBenevolentSexism","MFLowBenevolentSexism","FFLowBenevolentSexism","FMHighBenevolentSexism","MFHighBenevolentSexism","FFHighBenevolentSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Benevolent Sexism#
mean(parsIC[,1,i])
#FM High Benevolent Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Low Benevolent Sexism#
mean(parsIC[,2,i])
#MF High Benevolent Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Low Benevolent Sexism#
mean(parsIC[,3,i])
#FF High Benevolent Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 2###
reg.BenevSex2 <- lm(TESS$Disapproval ~ MM_Engage*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + 
                      FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + 
                      FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + Education5 + HostileSexism +
                      MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                      RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.BenevSex2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.BenevSex2))) 
colnames(storageIC) <- names(coef(reg.BenevSex2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*BenevolentSexismIQR + MM_NotEngage*BenevolentSexismIQR + FM_StayOut*BenevolentSexismIQR + FM_NotEngage*BenevolentSexismIQR + FM_Engage*BenevolentSexismIQR + MF_StayOut*BenevolentSexismIQR + MF_NotEngage*BenevolentSexismIQR + MF_Engage*BenevolentSexismIQR + FF_StayOut*BenevolentSexismIQR + FF_NotEngage*BenevolentSexismIQR + FF_Engage*BenevolentSexismIQR + DemocratUS + HostileSexism + Age4 + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowBenevolentSexism","MFLowBenevolentSexism","FFLowBenevolentSexism","FMHighBenevolentSexism","MFHighBenevolentSexism","FFHighBenevolentSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Benevolent Sexism#
mean(parsIC[,1,i])
#FM High Benevolent Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Low Benevolent Sexism#
mean(parsIC[,2,i])
#MF High Benevolent Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Low Benevolent Sexism#
mean(parsIC[,3,i])
#FF High Benevolent Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 3###
reg.HosSex1 <- lm(TESS2$Disapproval ~ MM_Engage*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + 
                    FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + 
                    FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Education5 + BenevolentSexism +
                    MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.HosSex1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.HosSex1))) 
colnames(storageIC) <- names(coef(reg.HosSex1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Age4 + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowHostileSexism","MFLowHostileSexism","FFLowHostileSexism","FMHighHostileSexism","MFHighHostileSexism","FFHighHostileSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Hostile Sexism#
mean(parsIC[,1,i])
#FM High Hostile Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Low Hostile Sexism#
mean(parsIC[,2,i])
#MF High Hostile Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Low Hostile Sexism#
mean(parsIC[,3,i])
#FF High Hostile Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 4###
reg.HosSex2 <- lm(TESS$Disapproval ~ MM_Engage*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + 
                    FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + 
                    FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Education5 + BenevolentSexism +
                    MilAssert + Age4 + Gender + PartyID + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.HosSex2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.HosSex2))) 
colnames(storageIC) <- names(coef(reg.HosSex2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*HostileSexismIQR + MM_NotEngage*HostileSexismIQR + FM_StayOut*HostileSexismIQR + FM_NotEngage*HostileSexismIQR + FM_Engage*HostileSexismIQR + MF_StayOut*HostileSexismIQR + MF_NotEngage*HostileSexismIQR + MF_Engage*HostileSexismIQR + FF_StayOut*HostileSexismIQR + FF_NotEngage*HostileSexismIQR + FF_Engage*HostileSexismIQR + DemocratUS + Age4 + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMLowHostileSexism","MFLowHostileSexism","FFLowHostileSexism","FMHighHostileSexism","MFHighHostileSexism","FFHighHostileSexism", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Low Hostile Sexism#
mean(parsIC[,1,i])
#FM High Hostile Sexism#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Low Hostile Sexism#
mean(parsIC[,2,i])
#MF High Hostile Sexism#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Low Hostile Sexism#
mean(parsIC[,3,i])
#FF High Hostile Sexism#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 5###
reg.Age1 <- lm(TESS2$Disapproval ~ MM_Engage*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + 
                 FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + 
                 FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.Age1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Age1))) 
colnames(storageIC) <- names(coef(reg.Age1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMYoung","MFYoung","FFYoung","FMOld","MFOld","FFOld", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Young#
mean(parsIC[,1,i])
#FM Old#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Young#
mean(parsIC[,2,i])
#MF Old#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Young#
mean(parsIC[,3,i])
#FF Old#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 6###
reg.Age2 <- lm(TESS$Disapproval ~ MM_Engage*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + 
                 FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + 
                 FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.Age2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Age2))) 
colnames(storageIC) <- names(coef(reg.Age2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*AgeIQR + MM_NotEngage*AgeIQR + FM_StayOut*AgeIQR + FM_NotEngage*AgeIQR + FM_Engage*AgeIQR + MF_StayOut*AgeIQR + MF_NotEngage*AgeIQR + MF_Engage*AgeIQR + FF_StayOut*AgeIQR + FF_NotEngage*AgeIQR + FF_Engage*AgeIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMYoung","MFYoung","FFYoung","FMOld","MFOld","FFOld", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Young#
mean(parsIC[,1,i])
#FM Old#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] < 0))/nrow(parsIC)
#MF Young#
mean(parsIC[,2,i])
#MF Old#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] < 0))/nrow(parsIC)
#FF Young#
mean(parsIC[,3,i])
#FF Old#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] < 0))/nrow(parsIC)

###Column 7###
reg.PID1 <- lm(TESS2$Disapproval ~ MM_Engage*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + 
                 FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + 
                 FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.PID1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.PID1))) 
colnames(storageIC) <- names(coef(reg.PID1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Republican#
mean(parsIC[,1,i])
#FM Democrat#
mean(parsIC[,4,i])
#FM P-Value of Difference#
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Republican#
mean(parsIC[,2,i])
#MF Democrat#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Republican#
mean(parsIC[,3,i])
#FF Democrat#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 8### 
reg.PID2 <- lm(TESS$Disapproval ~ MM_Engage*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + 
                 FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + 
                 FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism +
                 MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + 
                 RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.PID2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.PID2))) 
colnames(storageIC) <- names(coef(reg.PID2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*PartyIDIQR + MM_NotEngage*PartyIDIQR + FM_StayOut*PartyIDIQR + FM_NotEngage*PartyIDIQR + FM_Engage*PartyIDIQR + MF_StayOut*PartyIDIQR + MF_NotEngage*PartyIDIQR + MF_Engage*PartyIDIQR + FF_StayOut*PartyIDIQR + FF_NotEngage*PartyIDIQR + FF_Engage*PartyIDIQR + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMRepublican","MFRepublican","FFRepublican","FMDemocrat","MFDemocrat","FFDemocrat", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Republican#
mean(parsIC[,1,i])
#FM Democrat#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Republican#
mean(parsIC[,2,i])
#MF Democrat#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Republican#
mean(parsIC[,3,i])
#FF Democrat#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 9###
reg.Gender1 <- lm(TESS2$Disapproval ~ MM_Engage*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + 
                    FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + 
                    FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism +
                    MilAssert + PartyID + Age4 + Education5 + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS2)

summary(reg.Gender1)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Gender1))) 
colnames(storageIC) <- names(coef(reg.Gender1))
for (i in 1:B){
  resample <- sample(1:nrow(TESS2),nrow(TESS2),replace=T)
  temp <- TESS2[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMMale","MFMale","FFMale","FMFemale","MFFemale","FFFemale", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Male#
mean(parsIC[,1,i])
#FM Female#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Male#
mean(parsIC[,2,i])
#MF Female#
mean(parsIC[,5,i])
#MF P-Value of Difference#
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Male#
mean(parsIC[,3,i])
#FF Female#
mean(parsIC[,6,i])
#FF P-Value of Difference# 
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)

###Column 10###
reg.Gender2 <- lm(TESS$Disapproval ~ MM_Engage*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + 
                    FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + 
                    FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism +
                    MilAssert + PartyID + Age4 + Education5 + Income6 + SexismOrder + 
                    RegimeConfounding + NonWhiteConfounding, data=TESS)

summary(reg.Gender2)

RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

storageIC <- matrix(NA, B,length(coef(reg.Gender2))) 
colnames(storageIC) <- names(coef(reg.Gender2))
for (i in 1:B){
  resample <- sample(1:nrow(TESS),nrow(TESS),replace=T)
  temp <- TESS[resample,]
  mod.temp <- lm(Disapproval ~ MM_Engage*Gender + MM_NotEngage*Gender + FM_StayOut*Gender + FM_NotEngage*Gender + FM_Engage*Gender + MF_StayOut*Gender + MF_NotEngage*Gender + MF_Engage*Gender + FF_StayOut*Gender + FF_NotEngage*Gender + FF_Engage*Gender + DemocratUS + HostileSexism + BenevolentSexism + MilAssert + PartyID + Age4 + Education5 + Income6 + SexismOrder + RegimeConfounding + NonWhiteConfounding, data=temp)
  storageIC[i,] <- coef(mod.temp)
  drop(list(resample,temp))
}

m <- c(0,1)

parsIC <- array(NA, dim=c(B,9,length(m)), dimnames=list(NULL, c("FMMale","MFMale","FFMale","FMFemale","MFFemale","FFFemale", "FM_Difference", "MF_Difference", "FF_Difference"), round(m,digits=2)))
for (i in 1:length(m)){
  parsIC[,1,i] <- (storageIC[,7] - storageIC[,5]) - (storageIC[,2]) 
  parsIC[,2,i] <- (storageIC[,10] - storageIC[,8]) - (storageIC[,2]) 
  parsIC[,3,i] <- (storageIC[,13] - storageIC[,11]) - (storageIC[,2]) 
  parsIC[,4,i] <- ((storageIC[,7] - storageIC[,5]) + (storageIC[,29] - storageIC[,27])) - (storageIC[,25] + storageIC[,2])
  parsIC[,5,i] <- ((storageIC[,10] - storageIC[,8]) + (storageIC[,32] - storageIC[,30])) - (storageIC[,25] + storageIC[,2])
  parsIC[,6,i] <- ((storageIC[,13] - storageIC[,11]) + (storageIC[,35] - storageIC[,33])) - (storageIC[,25] + storageIC[,2])
  parsIC[,7,i] <-  (parsIC[,4,i]) - (parsIC[,1,i])
  parsIC[,8,i] <-  (parsIC[,5,i]) - (parsIC[,2,i])
  parsIC[,9,i] <-  (parsIC[,6,i]) - (parsIC[,3,i])
}	

#FM Male#
mean(parsIC[,1,i])
#FM Female#
mean(parsIC[,4,i])
#FM P-Value of Difference# 
1- length(which(parsIC[,7,i] > 0))/nrow(parsIC)
#MF Male#
mean(parsIC[,2,i])
#MF Female#
mean(parsIC[,5,i])
#MF P-Value of Difference# 
1- length(which(parsIC[,8,i] > 0))/nrow(parsIC)
#FF Male#
mean(parsIC[,3,i])
#FF Female#
mean(parsIC[,6,i])
#FF P-Value of Difference#
1- length(which(parsIC[,9,i] > 0))/nrow(parsIC)




#####Table S.9#####
cor(TESS$HostileSexism, TESS$Republican, use="complete.obs")
cor(TESS$BenevolentSexism, TESS$Republican, use="complete.obs")

###Column 1###
Reg.Sexism1 <- lm(TESS$HostileSexism ~ Republican + DemocratUS + FemaleUS + FemaleOpp + Engage + 
                    NotEngage + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder, data=TESS)

summary(Reg.Sexism1)

###Column 2###
Reg.Sexism2 <- lm(TESS$BenevolentSexism ~ Republican + DemocratUS + FemaleUS + FemaleOpp + Engage + 
                    NotEngage + MilAssert + Age4 + Gender + Education5 + Income6 + SexismOrder, data=TESS)

summary(Reg.Sexism2)




#####Load mTurk.csv and Save as "Turk"#####


#####Drop Respondents that Failed the Attention Check####
Turk <- subset(Turk, Attention==2)


#####Table S.10####

##Bootstrapped Difference in Means##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, nrow=B, ncol=24)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    D <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    E <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    G <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==0)], na.rm=TRUE)
    H <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    I <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)
    J <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==0 & temp$FemaleOpp==1)], na.rm=TRUE)   
    K <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    L <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)
    M <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==1)], na.rm=TRUE)      
    N <- mean(temp$Disapproval[which(temp$StayOut==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    O <- mean(temp$Disapproval[which(temp$NotEngage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)
    P <- mean(temp$Disapproval[which(temp$Engage==1 & temp$FemaleUS==1 & temp$FemaleOpp==0)], na.rm=TRUE)     
    bootResults[i,1] <- (B-A)
    bootResults[i,2] <- (C-A)
    bootResults[i,3] <- (B-C)  
    bootResults[i,4] <- (E-D)
    bootResults[i,5] <- (G-D)
    bootResults[i,6] <- (E-G)  
    bootResults[i,7] <- (I-H)
    bootResults[i,8] <- (J-H)
    bootResults[i,9] <- (I-J)  
    bootResults[i,10] <- (L-K)
    bootResults[i,11] <- (M-K)
    bootResults[i,12] <- (L-M)  
    bootResults[i,13] <- (O-N)
    bootResults[i,14] <- (P-N)
    bootResults[i,15] <- (O-P)  
    bootResults[i,16] <- (I-H) - (E-D) 
    bootResults[i,17] <- (J-H) - (G-D) 
    bootResults[i,18] <- (I-J) - (E-G) 
    bootResults[i,19] <- (L-K) - (E-D) 
    bootResults[i,20] <- (M-K) - (G-D) 
    bootResults[i,21] <- (L-M) - (E-G) 
    bootResults[i,22] <- (O-N) - (E-D) 
    bootResults[i,23] <- (P-N) - (G-D) 
    bootResults[i,24] <- (O-P) - (E-G) 
    drop(list())
  }
  return(list(model=label, boot=bootResults, AC.Full=mean(bootResults[,1], na.rm=TRUE), 
              BC.Full=mean(bootResults[,2], na.rm=TRUE), IC.Full=mean(bootResults[,3], na.rm=TRUE), 
              AC.MM=mean(bootResults[,4], na.rm=TRUE), BC.MM=mean(bootResults[,5], na.rm=TRUE), 
              IC.MM=mean(bootResults[,6], na.rm=TRUE), AC.MF=mean(bootResults[,7], na.rm=TRUE), 
              BC.MF=mean(bootResults[,8], na.rm=TRUE), IC.MF=mean(bootResults[,9], na.rm=TRUE),
              AC.FF=mean(bootResults[,10], na.rm=TRUE), BC.FF=mean(bootResults[,11], na.rm=TRUE), 
              IC.FF=mean(bootResults[,12], na.rm=TRUE), AC.FM=mean(bootResults[,13], na.rm=TRUE), 
              BC.FM=mean(bootResults[,14], na.rm=TRUE), IC.FM=mean(bootResults[,15], na.rm=TRUE),
              AC.MFControl=mean(bootResults[,16], na.rm=TRUE), BC.MFControl=mean(bootResults[,17], na.rm=TRUE),
              IC.MFControl=mean(bootResults[,18], na.rm=TRUE), AC.FFControl=mean(bootResults[,19], na.rm=TRUE),
              BC.FFControl=mean(bootResults[,20], na.rm=TRUE), IC.FFControl=mean(bootResults[,21], na.rm=TRUE),
              AC.FMControl=mean(bootResults[,22], na.rm=TRUE), BC.FMControl=mean(bootResults[,23], na.rm=TRUE),
              IC.FMControl=mean(bootResults[,24], na.rm=TRUE)))
}

full.2 <- bootTreat2(Turk)

##FM Audience Costs Relative to the MM Control##
round(c(full.2$AC.FMControl, quantile(full.2$boot[,22], c(0.025, 0.975))), digits=3)
#FM Audience Costs#
round(c(full.2$AC.FM, quantile(full.2$boot[,13], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FF Audience Costs Relative to the MM Control##
round(c(full.2$AC.FFControl, quantile(full.2$boot[,19], c(0.025, 0.975))), digits=3)
#FF Audience Costs#
round(c(full.2$AC.FF, quantile(full.2$boot[,10], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##MF Audience Costs Relative to the MM Control##
round(c(full.2$AC.MFControl, quantile(full.2$boot[,16], c(0.025, 0.975))), digits=3)
#MF Audience Costs#
round(c(full.2$AC.MF, quantile(full.2$boot[,7], c(0.025, 0.975))), digits=3)
#MM Audience Costs#
round(c(full.2$AC.MM, quantile(full.2$boot[,4], c(0.025, 0.975))), digits=3)

##FM Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FMControl, quantile(full.2$boot[,24], c(0.025, 0.975))), digits=3)
#FM Inconsistency Costs#
round(c(full.2$IC.FM, quantile(full.2$boot[,15], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.FFControl, quantile(full.2$boot[,21], c(0.025, 0.975))), digits=3)
#FF Inconsistency Costs#
round(c(full.2$IC.FF, quantile(full.2$boot[,12], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##MF Inconsistency Costs Relative to the MM Control##
round(c(full.2$IC.MFControl, quantile(full.2$boot[,18], c(0.025, 0.975))), digits=3)
#MF Inconsistency Costs#
round(c(full.2$IC.MF, quantile(full.2$boot[,9], c(0.025, 0.975))), digits=3)
#MM Inconsistency Costs#
round(c(full.2$IC.MM, quantile(full.2$boot[,6], c(0.025, 0.975))), digits=3)

##FM Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FMControl, quantile(full.2$boot[,23], c(0.025, 0.975))), digits=3)
#FM Belligerence Costs#
round(c(full.2$BC.FM, quantile(full.2$boot[,14], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##FF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.FFControl, quantile(full.2$boot[,20], c(0.025, 0.975))), digits=3)
#FF Belligerence Costs#
round(c(full.2$BC.FF, quantile(full.2$boot[,11], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)

##MF Belligerence Costs Relative to the MM Control##
round(c(full.2$BC.MFControl, quantile(full.2$boot[,17], c(0.025, 0.975))), digits=3)
#MF Belligerence Costs#
round(c(full.2$BC.MF, quantile(full.2$boot[,8], c(0.025, 0.975))), digits=3)
#MM Belligerence Costs#
round(c(full.2$BC.MM, quantile(full.2$boot[,5], c(0.025, 0.975))), digits=3)



##P-Values for Audience Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==0))
FM <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==0))
MF <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==1))
FF <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==1))
Full <- bootTreat2(subset(Turk))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Inconsistency Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (B-C)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==0))
FM <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==0))
MF <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==1))
FF <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==1))
Full <- bootTreat2(subset(Turk))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(MM, FM)
#FF P-Value#
p.calc(MM, FF)
#MF P-Value#
p.calc(MM, MF)


##P-Values for Belligerence Costs Relative to the MM Control##
RNGkind(sample.kind="Rounding")
set.seed(43215)
B <- 2000 

bootTreat2 <- function(dat, label="Treatment"){
  bootResults <- matrix(NA, B)
  for (i in seq_len(B)){
    resample <- sample(1:nrow(dat),nrow(dat),replace=T)
    temp <- dat[resample,]
    A <- mean(temp$Disapproval[which(temp$StayOut==1)], na.rm=TRUE)
    B <- mean(temp$Disapproval[which(temp$NotEngage==1)], na.rm=TRUE)
    C <- mean(temp$Disapproval[which(temp$Engage==1)], na.rm=TRUE)
    bootResults[i] <- (C-A)
    drop(list())
  }
  return(list(model=label, boot=bootResults, ATE=mean(bootResults, na.rm=TRUE)))
}

MM <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==0))
FM <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==0))
MF <- bootTreat2(subset(Turk, Turk$FemaleUS==0 & Turk$FemaleOpp==1))
FF <- bootTreat2(subset(Turk, Turk$FemaleUS==1 & Turk$FemaleOpp==1))
Full <- bootTreat2(subset(Turk))

p.calc <- function(mod, mod2, test){
  if(missing(test)){
    x <- 1-length(which(mod$boot < mod2$boot))/length(mod$boot)	
  }
  return(round(x,digits=4))
}

#FM P-Value#
p.calc(FM, MM)
#FF P-Value#
p.calc(FF, MM)
#MF P-Value#
p.calc(MF, MM)





